library(shiny)
library(flexdashboard)
Nota Bene: The RStudio viewer does not display dashboards correctly. So use a web browser.
If your target is not a “normal”-size display (technical: 768 pixels or more in height), use the browser in emulation mode. - In Chrome, CMD-OPT-I brings up the console.
Set things up in YAML:
---
title: "Dashboard Value Boxes"
output:
flexdashboard::flex_dashboard:
orientation: rows
navbar:
- { title: "About", href: "https://example.com/about" }
- { title: "StatPREP", href: "https//statprep.org"}
---
The navbar is described in the YAML. But everything else is ordinary headings.
flexdashboard::flex_dashboard() is an R/Markdown renderer that treats headings specially.
#) – a page
##) – a row in a page. (Note: because YAML specified orientation: rows. Default is columns.)
###) – a box in a row
#)
data-icon=fa-umbrella attribute to set logo (if any). Note: fa- prefix is used, unlike with the icon() function in Shiny.##)
{data-width=350}{.tabset}spam <- 17
valueBox(
spam, icon = "fa-trash",
color = ifelse(spam > 10, "warning", "primary")
)
Essentially, a small library of colors intended to be use symantically:
success Greeninfo Bluewarning Orangedanger Red<shinydashboard>Unlike flexdashboards which is based on markdown, shinydashboard is based on the html-based construction kit that we used in fluidPage(), etc.
New elements:
valueBox()infoBox() – pretty display of one numberdropdownMenu() holds
messageItem()s: from, message, icon, time, hreftaskItem()s: text, value, color, hrefnotificationItem()s: text, icon, status, hrefbox() – a container based on Bootstrap 12-grid
tabBox() – contains tabPanel()sI don’t see many of these, but they are straightforward.
YAML:
---
title: "A Walk through Wonderland"
output:
flexdashboard::flex_dashboard:
storyboard: true
---
###)--- produces a side displayExample: Projects/Project-5-dashboards/storyboard.Rmd